package com.yuyue.springFramework.note08.entity.lifeCycle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
/**
 * Spring提供的生命周期相关方法
 */
public class LifeCycleBean {
    public LifeCycleBean(){
        System.err.println("***构造方法 LifeCycleBean***");
    }

    @Autowired
    public void autowire(@Value("${JAVA_HOME}") String javaHome){
        System.err.println("***@Value***");
    }

    @PostConstruct
    public void init(){
        System.err.println("***初始化前***");
    }

    @PreDestroy
    public void destroy(){
        System.err.println("***销毁***");
    }
}
